home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CU Amiga Super CD-ROM 27
/
CU Amiga Magazine's Super CD-ROM 27 (1998)(EMAP Images)(GB)[!][issue 1998-10].iso
/
CDSupport
/
IDer
/
Routines
/
ParseConfig.s
< prev
next >
Wrap
Text File
|
1997-02-18
|
2KB
|
78 lines
ParseConfig: Lea EntryTable(PC),A5 ;list of entries available to be included
Moveq #0,D2
.ParseLoop Move.L (A5)+,A3 ;get the next entry in the table
Cmp.L #-1,A3 ;is it the last entry
Beq.S .ParsingDone
Bsr.S .ParseEntry ;process the entry
Bra.S .ParseLoop
.ParsingDone Moveq #1,D2
.ParseLoop2 Move.L (A5)+,A3 ;get the next entry in the table
Cmp.L #-1,A3 ;is it the last entry
Beq.S .ParsingDone2
Bsr.S .ParseEntry ;process the entry
Bra.S .ParseLoop2
.ParsingDone2 Lea _Action(PC),A3
Moveq #-1,D2
Bsr.S .ParseEntry
;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Lea ConfigLine,A0 ;the parser put -1's in to break up the
Move.L #1023,D1 ;entries. If I had put 0's there, the
.Cleanup Move.B (A0),D0 ;parser would have thrown a wobbly
Beq.S .CleanupDone
Cmp.B #-1,D0 ;so I must now go through and convert
Bne.S .NotNeg ;all -1's into 0's, so the the main
Moveq #0,D0 ;routines can work properly
.NotNeg Move.B D0,(A0)+
DBra D1,.Cleanup
.CleanupDone Rts
;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
.ParseEntry Cmp.B #1,D2
Beq.S .NoAbbrev
Lea SearchString(PC),A4 ;this string is for using an abbreviated version of the full identifier
Move.B 4(A3),1(A4) ;get first character for abbreviated string
Move.L A4,A0 ;the string to look for
Lea ConfigLine,A1 ;the class entry to go looking through
Bsr FindData ;try and find the data
Tst.L D0
Beq.S .EntryFound
.NoAbbrev Lea 4(A3),A0 ;the full identifier. This is if the abbreviated version failed
Lea ConfigLine,A1 ;the line copied from the config file.
Bsr FindData
Tst.L D0
Bne.S .NoEntry
.EntryFound Move.B #-1,-1(A0) ;mark the start of the entry, by seperating it from the other's
Move.L A1,(A3) ;return the pointer of the data after the identifier
Cmp.B #-1,D2
Beq.S .WSpaceDone
Moveq #0,D0
Moveq #0,D1
.WSpaceLoop Move.B (A1)+,D0
Beq.S .WSpaceDone
Cmp.B #'\"',D0
Bne.S .NotQuote
Not.B D1
Bra.S .WSpaceLoop
.NotQuote Cmp.B #' ',D0
Bne.S .NotSpace
Tst.B D1
Beq.S .WSpaceEnd
.NotSpace Cmp.B #'\t',D0
Bne.S .WSpaceLoop
Tst.B D1
Bne.S .WSpaceLoop
.WSpaceEnd Move.B #-1,-1(A1)
.WSpaceDone Rts
.NoEntry Clr.L (A3) ;if no entry was found, clear the data from the previous usages
Rts